# 转换为整数int
# 字符串str ---> 整数int
# 纯数字的字符串
s = '2024'
n = int(s)
print(type(s), type(n))

# s1 = 'aaa123'
# print(int(s1))

# 浮点数float ---> 整数int
s1 = 2.23
print(int(s1), type(int(s1)))

# 布尔bool ---> 整数int
s2, s3 = True, False
print(int(s2), int(s3))

# 转换为浮点数float
# str ---> float
print(float(s)) # 有没有小数点都可以
# bool ---> float
print(float(s2), float(s3))

# 转换为布尔bool
# str ---> bool
s = 'sdw323'
print(bool(s)) # True
s1 = ''
print(bool(s1)) # False
# int ---> bool
n = 1
print(bool(n))
n = 0
print(bool(n))
# float ---> bool
f = 3.0
g = 0.0
print(bool(f)) # True
print(bool(g)) # False

# 转换为字符串str
# int ---> str
n = 5
print(type(str(n)), str(n))
# float ---> str
f = 5.3
print(type(str(f)), str(f))
# bool ---> str
a = True
print(type(str(a)), str(a))
